/*
 * AppJPacman.fx
 *
 * Created on 5/03/2010, 01:02:34 PM
 */


import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.control.TextBox;
import javafx.scene.layout.LayoutInfo;
import javafx.scene.layout.Panel;
import util.Maze;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.Text;
import javafx.scene.effect.PerspectiveTransform;
import util.FlipView;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;


/**
 * @author Alex
 */

 var css = "{__DIR__}default.css";

Stage {
    title: "ThinkPacMan"
    var scene:Scene;
    width: 700
    height: 700
    var flip = FlipView {
        translateX:0
        translateY:0
        backNode : ImageView {
                    image: Image {
                        url: "{__DIR__}util/images/fondo.png"
                    }

                };
        frontNode: new Maze();
    }
    //var maze:Maze = new Maze ();
    scene: scene = Scene {
            stylesheets: bind css
        content: [
            VBox {
                width: bind scene.width;
                //hpos: HPos.CENTER;
                layoutX:10;
                spacing: 10;
                var titulos:HBox;
                content: [
                        titulos = HBox {
                            nodeVPos: VPos.CENTER;
                            spacing: 10;
                            var itesm:Label;
                            content: [
                                VBox {
                                        hpos: HPos.CENTER;
                                        width: bind (scene.width*0.75-titulos.spacing*2)
                                        content: [
                                            Text {
                                                content: "Instituto Tecnológico y de Estudios Superiores de Monterrey\n"
                                                "Campus Ciudad de México"
                                                textAlignment: TextAlignment.CENTER;
                                                styleClass:"titulo"
                                             }

                                         ]
                                         scaleX: bind (scene.width / 700)
                                         scaleY: bind (scene.height / 700)

                                }

                               
                               VBox {
                                    hpos: HPos.CENTER;
                                    width: bind (scene.width*0.125-titulos.spacing*2)
                                    spacing: 10;
                                    content: [
                                        Text {
                                            content: "A00994415"
                                        }
                                        Text {
                                            content: "A01211101"
                                        }
                                    ]
                                    scaleX: bind (scene.width / 700)
                                    scaleY: bind (scene.height / 700)
                                }
                                VBox {
                                    hpos: HPos.CENTER;
                                    width: bind (scene.width*0.125-titulos.spacing*2)
                                    spacing: 10;
                                    content: [
                                        Text {
                                            content: "A01210989"
                                        }
                                        Text {
                                            content: "A01234567"
                                        }
                                    ]
                                    scaleX: bind (scene.width / 700)
                                    scaleY: bind (scene.height / 700)
                                }
                            ]
                        }
                        HBox {
                            nodeVPos: VPos.CENTER;
                            spacing: 10;
                            content: [
                                        Button {
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                            text: "Agente Reactivo"
                                            action: function() {
		
                                            }
                                        }
                                        Button {
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                            text: "Agente"
                                            action: function() {
		
                                            }
                                        }
                                        Button {
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                            text: "Agente"
                                            action: function() {
		
                                            }
                                        }
                                        Button {
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                            text: "Agente"
                                            action: function() {
		
                                            }
                                        }
                            ]
                        }
                        HBox {
                            spacing: 10;
                            vpos: VPos.CENTER;
                            height: bind (scene.height/700*576+20)
                            content: [
                                VBox {
                                    hpos: HPos.CENTER;
                                    width: bind (scene.width*0.75-titulos.spacing*2)
                                    spacing: 10;
                                    content: bind flip;
                                    scaleX: bind (scene.width / 700)
                                    scaleY: bind (scene.height / 700)
                                    styleClass:"maze"
                                    
                                }
                                VBox {
                                    width: bind (scene.width*0.25-titulos.spacing*2)
                                    hpos: HPos.CENTER;
                                    spacing: 10;
                                    content: [
                                        Label {
                                            text: "Label:"
                                        }
                                        Label {
                                            text: "Labe2:"
                                        }
                                        Label {
                                            text: "Labe3:"
                                        }
                                        Label {
                                            text: "Labe4:"
                                        }
                                        Button {
                                            var textoPausa="Pausar"
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                            text: bind textoPausa
                                            action: function() {
                                                //maze.pause();
                                                //if (maze.paused) textoPausa = "Continuar"
                                                //else textoPausa = "Pausar"
                                                flip.frontNode.pause();
                                                if (flip.frontNode.paused) textoPausa = "Continuar"
                                                else textoPausa = "Pausar"
                                            }
                                            styleClass:"pausa"

                                        }
                                        Button {
                                            layoutInfo: LayoutInfo{
                                                minWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                                width: bind (scene.width / 4 - titulos.spacing*1.5)
                                                maxWidth: bind (scene.width / 4 - titulos.spacing*1.5)
                                            }
                                                text: "Reiniciar"
                                                action: function() {
                                                    flip.frontNode.pause();
                                                    flip.doFlip();
                                                    Timeline {
        keyFrames: [
            KeyFrame { time: 1.0s action: function() { flip = FlipView {
                                                        translateX:0
                                                        translateY:0
                                                        backNode : ImageView {
                                                                    image: Image {
                                                                        url: "{__DIR__}util/images/fondo.png"
                                                                    }

                                                                };
                                                        frontNode: new Maze();
                                                    } } }
        ]
    }.play()
                                                    
                                                    
                                                }
                                        }
                                        Text {
                                            content: "Pausar - Barra espaciadora\n"
                                        }

                                    ]
                                }
                           ]
                        }
                ]
            }

        ]
    }
}

